package com.meiyu.live.ui.mine;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.meiyu.live.BaseActivity;
import com.meiyu.live.R;
import com.meiyu.live.comm.Constant;

/**
 * Created by zbl on 2017/1/20.
 * 政策与隐私界面
 */
public class PolicyActivity extends BaseActivity implements View.OnClickListener {
    private View btn_back;
    private WebView webview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_policy);
        init();
    }

    private void init() {
        btn_back = findViewById(R.id.btn_back);
        btn_back.setOnClickListener(this);
        webview = (WebView) findViewById(R.id.webview);
        webview.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
        webview.loadUrl(Constant.POLICY_URL);
    }

    @Override
    public void onClick(View view) {
        if (view == btn_back) {
            finish();
        }
    }

    @Override
    public void onBackPressed() {
        if (webview.canGoBack()) {
            webview.goBack();
        } else {
            super.onBackPressed();
        }
    }
}
